// $ANTLR 3.4 C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g 2011-11-06 14:12:42

    // This section is pasted into the top of the generated
    // file.  We use it to declare a package here.  Other packages
    // can also be imported as required.
    package cs536.syntax;

    import static cs536.ast.AbstractSyntaxTree.*;
    import cs536.ast.SourceLocation;


import org.antlr.runtime.*;
import java.util.Stack;
import java.util.List;
import java.util.ArrayList;

@SuppressWarnings({"all", "warnings", "unchecked"})
public class MinCParser extends Parser {
    public static final String[] tokenNames = new String[] {
        "<invalid>", "<EOR>", "<DOWN>", "<UP>", "ADDROF", "ALPHA", "ASSIGN", "BAD_IDENT", "BLOCK_COMMENT", "BLOCK_COMMENT_CONTENTS", "BOOL", "COMMA", "DECR", "DIGIT", "DIV", "DOUBLE", "ELSE", "EQUAL", "FALSE", "FLOAT_LIT", "GT", "GTE", "IDENT", "IDENT_CONTINUE", "IDENT_START", "IF", "ILLEGAL_ESCAPE", "ILLEGAL_ESCAPE_STRING_CHAR", "INCR", "INT", "INTEGER", "INT_LIT", "LAND", "LBRACE", "LBRACKET", "LEADING_ZERO_FLOAT", "LEADING_ZERO_INT", "LINE_COMMENT", "LNOT", "LOR", "LOWER", "LPAREN", "LT", "LTE", "MINUS", "MOD", "NEQUAL", "NULL", "PLUS", "RBRACE", "RBRACKET", "READ", "RETURN", "RPAREN", "SEMI", "STAR", "STRING", "STRING_CHAR", "STRING_LIT", "STRING_WITH_ILLEGAL_ESCAPE", "STRING_WITH_TAB", "TAB_STRING_CHAR", "TRUE", "UNTERM_BLOCK_COMMENT", "UNTERM_STRING", "UPPER", "VALID_ESCAPE_CHAR", "VOID", "WHILE", "WHITESPACE", "WRITE"
    };

    public static final int EOF=-1;
    public static final int ADDROF=4;
    public static final int ALPHA=5;
    public static final int ASSIGN=6;
    public static final int BAD_IDENT=7;
    public static final int BLOCK_COMMENT=8;
    public static final int BLOCK_COMMENT_CONTENTS=9;
    public static final int BOOL=10;
    public static final int COMMA=11;
    public static final int DECR=12;
    public static final int DIGIT=13;
    public static final int DIV=14;
    public static final int DOUBLE=15;
    public static final int ELSE=16;
    public static final int EQUAL=17;
    public static final int FALSE=18;
    public static final int FLOAT_LIT=19;
    public static final int GT=20;
    public static final int GTE=21;
    public static final int IDENT=22;
    public static final int IDENT_CONTINUE=23;
    public static final int IDENT_START=24;
    public static final int IF=25;
    public static final int ILLEGAL_ESCAPE=26;
    public static final int ILLEGAL_ESCAPE_STRING_CHAR=27;
    public static final int INCR=28;
    public static final int INT=29;
    public static final int INTEGER=30;
    public static final int INT_LIT=31;
    public static final int LAND=32;
    public static final int LBRACE=33;
    public static final int LBRACKET=34;
    public static final int LEADING_ZERO_FLOAT=35;
    public static final int LEADING_ZERO_INT=36;
    public static final int LINE_COMMENT=37;
    public static final int LNOT=38;
    public static final int LOR=39;
    public static final int LOWER=40;
    public static final int LPAREN=41;
    public static final int LT=42;
    public static final int LTE=43;
    public static final int MINUS=44;
    public static final int MOD=45;
    public static final int NEQUAL=46;
    public static final int NULL=47;
    public static final int PLUS=48;
    public static final int RBRACE=49;
    public static final int RBRACKET=50;
    public static final int READ=51;
    public static final int RETURN=52;
    public static final int RPAREN=53;
    public static final int SEMI=54;
    public static final int STAR=55;
    public static final int STRING=56;
    public static final int STRING_CHAR=57;
    public static final int STRING_LIT=58;
    public static final int STRING_WITH_ILLEGAL_ESCAPE=59;
    public static final int STRING_WITH_TAB=60;
    public static final int TAB_STRING_CHAR=61;
    public static final int TRUE=62;
    public static final int UNTERM_BLOCK_COMMENT=63;
    public static final int UNTERM_STRING=64;
    public static final int UPPER=65;
    public static final int VALID_ESCAPE_CHAR=66;
    public static final int VOID=67;
    public static final int WHILE=68;
    public static final int WHITESPACE=69;
    public static final int WRITE=70;

    // delegates
    public Parser[] getDelegates() {
        return new Parser[] {};
    }

    // delegators


    public MinCParser(TokenStream input) {
        this(input, new RecognizerSharedState());
    }
    public MinCParser(TokenStream input, RecognizerSharedState state) {
        super(input, state);
    }

    public String[] getTokenNames() { return MinCParser.tokenNames; }
    public String getGrammarFileName() { return "C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g"; }


        // Utility function for turning a token into a source location. (These
        // will be used in future projects.) For now don't worry too much about
        // where you set your source locations; if you want to keep using your
        // code, make it "reasonable." In particular, for declarations, make it
        // the same as the thing being declared.
        private SourceLocation loc(Token tok) {
            return new SourceLocation(tok);
        }


        // Some utility functions for creating a list of one element.
        private List<Expression> makeList(Expression arg) {
            List<Expression> l = new ArrayList<Expression>();
            l.add(arg);
            return l;
        }

        private List<Statement> makeList(Statement arg) {
            List<Statement> l = new ArrayList<Statement>();
            l.add(arg);
            return l;
        }


        private List<FormalArg> makeList(FormalArg arg) {
            List<FormalArg> l = new ArrayList<FormalArg>();
            l.add(arg);
            return l;
        }


        // This overrides the function in the parser class BaseRecognizer
        // (provided by Antlr). It's called by Antlr to print the syntax
        // errors. We will hijack it so that we know there was a problem.
        public void emitErrorMessage(String msg)
        {
            super.emitErrorMessage(msg);
            encounteredError = true;
        }

        private boolean encounteredError = false;

        public boolean isSuccessful() {
            return !encounteredError;
        }



    // $ANTLR start "program"
    // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:161:1: program returns [List<GlobalDeclaration> list] : (d= decl )* ;
    public final List<GlobalDeclaration> program() throws RecognitionException {
        List<GlobalDeclaration> list = null;


        GlobalDeclaration d =null;


        try {
            // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:162:5: ( (d= decl )* )
            // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:162:19: (d= decl )*
            {
             list = new ArrayList<GlobalDeclaration>(); 

            // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:163:9: (d= decl )*
            loop1:
            do {
                int alt1=2;
                int LA1_0 = input.LA(1);

                if ( (LA1_0==BOOL||LA1_0==INT||LA1_0==STRING) ) {
                    alt1=1;
                }


                switch (alt1) {
            	case 1 :
            	    // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:163:10: d= decl
            	    {
            	    pushFollow(FOLLOW_decl_in_program99);
            	    d=decl();

            	    state._fsp--;


            	     list.add(d); 

            	    }
            	    break;

            	default :
            	    break loop1;
                }
            } while (true);


            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        return list;
    }
    // $ANTLR end "program"



    // $ANTLR start "groundType"
    // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:167:1: groundType returns [TypeNode node] : (l= INT |m= BOOL |n= STRING );
    public final TypeNode groundType() throws RecognitionException {
        TypeNode node = null;


        Token l=null;
        Token m=null;
        Token n=null;

        try {
            // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:168:5: (l= INT |m= BOOL |n= STRING )
            int alt2=3;
            switch ( input.LA(1) ) {
            case INT:
                {
                alt2=1;
                }
                break;
            case BOOL:
                {
                alt2=2;
                }
                break;
            case STRING:
                {
                alt2=3;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 2, 0, input);

                throw nvae;

            }

            switch (alt2) {
                case 1 :
                    // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:168:7: l= INT
                    {
                    l=(Token)match(input,INT,FOLLOW_INT_in_groundType137); 

                     node = new IntType(loc(l));     

                    }
                    break;
                case 2 :
                    // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:169:7: m= BOOL
                    {
                    m=(Token)match(input,BOOL,FOLLOW_BOOL_in_groundType154); 

                     node = new BooleanType(loc(m));    

                    }
                    break;
                case 3 :
                    // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:170:7: n= STRING
                    {
                    n=(Token)match(input,STRING,FOLLOW_STRING_in_groundType170); 

                     node = new StringType(loc(n));    

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        return node;
    }
    // $ANTLR end "groundType"



    // $ANTLR start "type"
    // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:173:1: type returns [TypeNode node] : (t= groundType |o= groundType p= STAR |q= groundType r= LBRACKET s= INT_LIT RBRACKET );
    public final TypeNode type() throws RecognitionException {
        TypeNode node = null;


        Token p=null;
        Token r=null;
        Token s=null;
        TypeNode t =null;

        TypeNode o =null;

        TypeNode q =null;


        try {
            // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:174:5: (t= groundType |o= groundType p= STAR |q= groundType r= LBRACKET s= INT_LIT RBRACKET )
            int alt3=3;
            switch ( input.LA(1) ) {
            case INT:
                {
                switch ( input.LA(2) ) {
                case IDENT:
                    {
                    alt3=1;
                    }
                    break;
                case STAR:
                    {
                    alt3=2;
                    }
                    break;
                case LBRACKET:
                    {
                    alt3=3;
                    }
                    break;
                default:
                    NoViableAltException nvae =
                        new NoViableAltException("", 3, 1, input);

                    throw nvae;

                }

                }
                break;
            case BOOL:
                {
                switch ( input.LA(2) ) {
                case IDENT:
                    {
                    alt3=1;
                    }
                    break;
                case STAR:
                    {
                    alt3=2;
                    }
                    break;
                case LBRACKET:
                    {
                    alt3=3;
                    }
                    break;
                default:
                    NoViableAltException nvae =
                        new NoViableAltException("", 3, 2, input);

                    throw nvae;

                }

                }
                break;
            case STRING:
                {
                switch ( input.LA(2) ) {
                case IDENT:
                    {
                    alt3=1;
                    }
                    break;
                case STAR:
                    {
                    alt3=2;
                    }
                    break;
                case LBRACKET:
                    {
                    alt3=3;
                    }
                    break;
                default:
                    NoViableAltException nvae =
                        new NoViableAltException("", 3, 3, input);

                    throw nvae;

                }

                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 3, 0, input);

                throw nvae;

            }

            switch (alt3) {
                case 1 :
                    // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:174:7: t= groundType
                    {
                    pushFollow(FOLLOW_groundType_in_type197);
                    t=groundType();

                    state._fsp--;


                     node = t; 

                    }
                    break;
                case 2 :
                    // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:175:7: o= groundType p= STAR
                    {
                    pushFollow(FOLLOW_groundType_in_type232);
                    o=groundType();

                    state._fsp--;


                    p=(Token)match(input,STAR,FOLLOW_STAR_in_type236); 

                     node = new PointerType(loc(p), o); 

                    }
                    break;
                case 3 :
                    // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:176:7: q= groundType r= LBRACKET s= INT_LIT RBRACKET
                    {
                    pushFollow(FOLLOW_groundType_in_type248);
                    q=groundType();

                    state._fsp--;


                    r=(Token)match(input,LBRACKET,FOLLOW_LBRACKET_in_type252); 

                    s=(Token)match(input,INT_LIT,FOLLOW_INT_LIT_in_type256); 

                    match(input,RBRACKET,FOLLOW_RBRACKET_in_type258); 

                     node = new ArrayType(loc(r), q, ((IntLitToken)s).getValue()); 

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        return node;
    }
    // $ANTLR end "type"



    // $ANTLR start "funcType"
    // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:179:1: funcType returns [TypeNode node] : ty= type ;
    public final TypeNode funcType() throws RecognitionException {
        TypeNode node = null;


        TypeNode ty =null;


        try {
            // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:180:5: (ty= type )
            // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:180:7: ty= type
            {
            pushFollow(FOLLOW_type_in_funcType283);
            ty=type();

            state._fsp--;


             node = ty;   

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        return node;
    }
    // $ANTLR end "funcType"



    // $ANTLR start "stmt"
    // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:186:1: stmt returns [Statement node] : (e= exp SEMI |i= IF LPAREN cond= exp RPAREN thenBody= stmtOrBody ( options {greedy=true; } : ELSE elseBody= stmtOrBody |) );
    public final Statement stmt() throws RecognitionException {
        Statement node = null;


        Token i=null;
        Expression e =null;

        Expression cond =null;

        List<Statement> thenBody =null;

        List<Statement> elseBody =null;


        try {
            // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:187:5: (e= exp SEMI |i= IF LPAREN cond= exp RPAREN thenBody= stmtOrBody ( options {greedy=true; } : ELSE elseBody= stmtOrBody |) )
            int alt5=2;
            int LA5_0 = input.LA(1);

            if ( (LA5_0==BOOL||LA5_0==FLOAT_LIT||LA5_0==INT_LIT||LA5_0==MINUS||LA5_0==STRING_LIT) ) {
                alt5=1;
            }
            else if ( (LA5_0==IF) ) {
                alt5=2;
            }
            else {
                NoViableAltException nvae =
                    new NoViableAltException("", 5, 0, input);

                throw nvae;

            }
            switch (alt5) {
                case 1 :
                    // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:187:7: e= exp SEMI
                    {
                    pushFollow(FOLLOW_exp_in_stmt312);
                    e=exp();

                    state._fsp--;


                    match(input,SEMI,FOLLOW_SEMI_in_stmt314); 

                     node = new ExpressionStmt(e.getLocation(), e); 

                    }
                    break;
                case 2 :
                    // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:188:7: i= IF LPAREN cond= exp RPAREN thenBody= stmtOrBody ( options {greedy=true; } : ELSE elseBody= stmtOrBody |)
                    {
                    i=(Token)match(input,IF,FOLLOW_IF_in_stmt340); 

                    match(input,LPAREN,FOLLOW_LPAREN_in_stmt342); 

                    pushFollow(FOLLOW_exp_in_stmt346);
                    cond=exp();

                    state._fsp--;


                    match(input,RPAREN,FOLLOW_RPAREN_in_stmt348); 

                    pushFollow(FOLLOW_stmtOrBody_in_stmt352);
                    thenBody=stmtOrBody();

                    state._fsp--;


                    // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:189:9: ( options {greedy=true; } : ELSE elseBody= stmtOrBody |)
                    int alt4=2;
                    int LA4_0 = input.LA(1);

                    if ( (LA4_0==ELSE) ) {
                        alt4=1;
                    }
                    else if ( (LA4_0==RBRACE) ) {
                        alt4=2;
                    }
                    else {
                        NoViableAltException nvae =
                            new NoViableAltException("", 4, 0, input);

                        throw nvae;

                    }
                    switch (alt4) {
                        case 1 :
                            // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:190:12: ELSE elseBody= stmtOrBody
                            {
                            match(input,ELSE,FOLLOW_ELSE_in_stmt382); 

                            pushFollow(FOLLOW_stmtOrBody_in_stmt386);
                            elseBody=stmtOrBody();

                            state._fsp--;


                             node = new IfStmt(loc(i), cond, thenBody, elseBody); 

                            }
                            break;
                        case 2 :
                            // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:191:38: 
                            {
                             node = new IfStmt(loc(i), cond, thenBody, new ArrayList<Statement>()); 

                            }
                            break;

                    }


                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        return node;
    }
    // $ANTLR end "stmt"



    // $ANTLR start "stmtOrBody"
    // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:195:1: stmtOrBody returns [List<Statement> list] : s= stmt ;
    public final List<Statement> stmtOrBody() throws RecognitionException {
        List<Statement> list = null;


        Statement s =null;


        try {
            // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:196:5: (s= stmt )
            // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:196:7: s= stmt
            {
            pushFollow(FOLLOW_stmt_in_stmtOrBody461);
            s=stmt();

            state._fsp--;


             list = makeList(s); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        return list;
    }
    // $ANTLR end "stmtOrBody"



    // $ANTLR start "funcDecl"
    // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:201:1: funcDecl returns [FuncDecl node] : ret= funcType name= IDENT LPAREN RPAREN LBRACE body= stmt RBRACE ;
    public final FuncDecl funcDecl() throws RecognitionException {
        FuncDecl node = null;


        Token name=null;
        TypeNode ret =null;

        Statement body =null;


        try {
            // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:202:5: (ret= funcType name= IDENT LPAREN RPAREN LBRACE body= stmt RBRACE )
            // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:202:7: ret= funcType name= IDENT LPAREN RPAREN LBRACE body= stmt RBRACE
            {
            pushFollow(FOLLOW_funcType_in_funcDecl509);
            ret=funcType();

            state._fsp--;


            name=(Token)match(input,IDENT,FOLLOW_IDENT_in_funcDecl513); 

            match(input,LPAREN,FOLLOW_LPAREN_in_funcDecl515); 

            match(input,RPAREN,FOLLOW_RPAREN_in_funcDecl517); 

            match(input,LBRACE,FOLLOW_LBRACE_in_funcDecl519); 

            pushFollow(FOLLOW_stmt_in_funcDecl523);
            body=stmt();

            state._fsp--;


            match(input,RBRACE,FOLLOW_RBRACE_in_funcDecl525); 

             node = new FuncDecl(loc(name), ret, name.getText(), new ArrayList<FormalArg>(), makeList(body)); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        return node;
    }
    // $ANTLR end "funcDecl"



    // $ANTLR start "decl"
    // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:211:1: decl returns [GlobalDeclaration node] : f= funcDecl ;
    public final GlobalDeclaration decl() throws RecognitionException {
        GlobalDeclaration node = null;


        FuncDecl f =null;


        try {
            // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:212:5: (f= funcDecl )
            // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:212:7: f= funcDecl
            {
            pushFollow(FOLLOW_funcDecl_in_decl560);
            f=funcDecl();

            state._fsp--;


             node = f; 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        return node;
    }
    // $ANTLR end "decl"



    // $ANTLR start "literalExp"
    // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:217:1: literalExp returns [LiteralExp node] : (l= INT_LIT |m= STRING_LIT |o= BOOL |p= FLOAT_LIT );
    public final LiteralExp literalExp() throws RecognitionException {
        LiteralExp node = null;


        Token l=null;
        Token m=null;
        Token o=null;
        Token p=null;

        try {
            // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:218:5: (l= INT_LIT |m= STRING_LIT |o= BOOL |p= FLOAT_LIT )
            int alt6=4;
            switch ( input.LA(1) ) {
            case INT_LIT:
                {
                alt6=1;
                }
                break;
            case STRING_LIT:
                {
                alt6=2;
                }
                break;
            case BOOL:
                {
                alt6=3;
                }
                break;
            case FLOAT_LIT:
                {
                alt6=4;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 6, 0, input);

                throw nvae;

            }

            switch (alt6) {
                case 1 :
                    // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:218:7: l= INT_LIT
                    {
                    l=(Token)match(input,INT_LIT,FOLLOW_INT_LIT_in_literalExp598); 

                     node = new IntLit(loc(l),    ((IntLitToken)l).getValue());   

                    }
                    break;
                case 2 :
                    // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:219:7: m= STRING_LIT
                    {
                    m=(Token)match(input,STRING_LIT,FOLLOW_STRING_LIT_in_literalExp622); 

                     node = new StringLit(loc(m), ((MinCToken)m).getRepresentation()); 

                    }
                    break;
                case 3 :
                    // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:220:7: o= BOOL
                    {
                    o=(Token)match(input,BOOL,FOLLOW_BOOL_in_literalExp634); 

                     if (((MinCToken)o).getRepresentation().equals("TRUE")) {
                                      node = new BooleanLit(loc(o), true);
                                    } else {
                                      node = new BooleanLit(loc(o), false);
                                    }  
                                 

                    }
                    break;
                case 4 :
                    // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:226:7: p= FLOAT_LIT
                    {
                    p=(Token)match(input,FLOAT_LIT,FOLLOW_FLOAT_LIT_in_literalExp646); 

                     node = new DoubleLit(loc(p), ((FloatLitToken)p).getValue());  

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        return node;
    }
    // $ANTLR end "literalExp"



    // $ANTLR start "atomExp"
    // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:254:1: atomExp returns [Expression node] : lit= literalExp ;
    public final Expression atomExp() throws RecognitionException {
        Expression node = null;


        LiteralExp lit =null;


        try {
            // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:255:5: (lit= literalExp )
            // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:255:7: lit= literalExp
            {
            pushFollow(FOLLOW_literalExp_in_atomExp696);
            lit=literalExp();

            state._fsp--;


             node = lit; 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        return node;
    }
    // $ANTLR end "atomExp"



    // $ANTLR start "minusExp"
    // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:265:1: minusExp returns [Expression node] : (m= MINUS e= minusExp |e= atomExp );
    public final Expression minusExp() throws RecognitionException {
        Expression node = null;


        Token m=null;
        Expression e =null;


        try {
            // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:266:5: (m= MINUS e= minusExp |e= atomExp )
            int alt7=2;
            int LA7_0 = input.LA(1);

            if ( (LA7_0==MINUS) ) {
                alt7=1;
            }
            else if ( (LA7_0==BOOL||LA7_0==FLOAT_LIT||LA7_0==INT_LIT||LA7_0==STRING_LIT) ) {
                alt7=2;
            }
            else {
                NoViableAltException nvae =
                    new NoViableAltException("", 7, 0, input);

                throw nvae;

            }
            switch (alt7) {
                case 1 :
                    // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:266:7: m= MINUS e= minusExp
                    {
                    m=(Token)match(input,MINUS,FOLLOW_MINUS_in_minusExp740); 

                    pushFollow(FOLLOW_minusExp_in_minusExp744);
                    e=minusExp();

                    state._fsp--;


                     node = new NegationOp(loc(m), e); 

                    }
                    break;
                case 2 :
                    // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:267:7: e= atomExp
                    {
                    pushFollow(FOLLOW_atomExp_in_minusExp759);
                    e=atomExp();

                    state._fsp--;


                     node = e; 

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        return node;
    }
    // $ANTLR end "minusExp"



    // $ANTLR start "addExp"
    // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:282:1: addExp returns [Expression node] : e= minusExp (p= PLUS r= minusExp |m= MINUS r= minusExp )* ;
    public final Expression addExp() throws RecognitionException {
        Expression node = null;


        Token p=null;
        Token m=null;
        Expression e =null;

        Expression r =null;


        try {
            // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:283:5: (e= minusExp (p= PLUS r= minusExp |m= MINUS r= minusExp )* )
            // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:283:7: e= minusExp (p= PLUS r= minusExp |m= MINUS r= minusExp )*
            {
            pushFollow(FOLLOW_minusExp_in_addExp808);
            e=minusExp();

            state._fsp--;


             node = e; 

            // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:284:9: (p= PLUS r= minusExp |m= MINUS r= minusExp )*
            loop8:
            do {
                int alt8=3;
                int LA8_0 = input.LA(1);

                if ( (LA8_0==PLUS) ) {
                    alt8=1;
                }
                else if ( (LA8_0==MINUS) ) {
                    alt8=2;
                }


                switch (alt8) {
            	case 1 :
            	    // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:284:11: p= PLUS r= minusExp
            	    {
            	    p=(Token)match(input,PLUS,FOLLOW_PLUS_in_addExp840); 

            	    pushFollow(FOLLOW_minusExp_in_addExp844);
            	    r=minusExp();

            	    state._fsp--;


            	     node = new AddOp(node.getLocation(), node, r); 

            	    }
            	    break;
            	case 2 :
            	    // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:285:11: m= MINUS r= minusExp
            	    {
            	    m=(Token)match(input,MINUS,FOLLOW_MINUS_in_addExp865); 

            	    pushFollow(FOLLOW_minusExp_in_addExp869);
            	    r=minusExp();

            	    state._fsp--;


            	     node = new SubtractOp(node.getLocation(), node, r); 

            	    }
            	    break;

            	default :
            	    break loop8;
                }
            } while (true);


            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        return node;
    }
    // $ANTLR end "addExp"



    // $ANTLR start "assignExp"
    // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:309:1: assignExp returns [Expression node] : e= addExp ;
    public final Expression assignExp() throws RecognitionException {
        Expression node = null;


        Expression e =null;


        try {
            // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:310:5: (e= addExp )
            // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:310:7: e= addExp
            {
            pushFollow(FOLLOW_addExp_in_assignExp929);
            e=addExp();

            state._fsp--;


             node = e; 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        return node;
    }
    // $ANTLR end "assignExp"



    // $ANTLR start "exp"
    // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:314:1: exp returns [Expression node] : e= assignExp ;
    public final Expression exp() throws RecognitionException {
        Expression node = null;


        Expression e =null;


        try {
            // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:315:5: (e= assignExp )
            // C:\\Users\\Zach\\workspace\\MinCParser\\src\\cs536\\syntax\\MinC.g:315:7: e= assignExp
            {
            pushFollow(FOLLOW_assignExp_in_exp971);
            e=assignExp();

            state._fsp--;


             node = e; 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        return node;
    }
    // $ANTLR end "exp"

    // Delegated rules


 

    public static final BitSet FOLLOW_decl_in_program99 = new BitSet(new long[]{0x0100000020000402L});
    public static final BitSet FOLLOW_INT_in_groundType137 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_BOOL_in_groundType154 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_STRING_in_groundType170 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_groundType_in_type197 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_groundType_in_type232 = new BitSet(new long[]{0x0080000000000000L});
    public static final BitSet FOLLOW_STAR_in_type236 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_groundType_in_type248 = new BitSet(new long[]{0x0000000400000000L});
    public static final BitSet FOLLOW_LBRACKET_in_type252 = new BitSet(new long[]{0x0000000080000000L});
    public static final BitSet FOLLOW_INT_LIT_in_type256 = new BitSet(new long[]{0x0004000000000000L});
    public static final BitSet FOLLOW_RBRACKET_in_type258 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_type_in_funcType283 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_exp_in_stmt312 = new BitSet(new long[]{0x0040000000000000L});
    public static final BitSet FOLLOW_SEMI_in_stmt314 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_IF_in_stmt340 = new BitSet(new long[]{0x0000020000000000L});
    public static final BitSet FOLLOW_LPAREN_in_stmt342 = new BitSet(new long[]{0x0400100080080400L});
    public static final BitSet FOLLOW_exp_in_stmt346 = new BitSet(new long[]{0x0020000000000000L});
    public static final BitSet FOLLOW_RPAREN_in_stmt348 = new BitSet(new long[]{0x0400100082080400L});
    public static final BitSet FOLLOW_stmtOrBody_in_stmt352 = new BitSet(new long[]{0x0000000000010002L});
    public static final BitSet FOLLOW_ELSE_in_stmt382 = new BitSet(new long[]{0x0400100082080400L});
    public static final BitSet FOLLOW_stmtOrBody_in_stmt386 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_stmt_in_stmtOrBody461 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_funcType_in_funcDecl509 = new BitSet(new long[]{0x0000000000400000L});
    public static final BitSet FOLLOW_IDENT_in_funcDecl513 = new BitSet(new long[]{0x0000020000000000L});
    public static final BitSet FOLLOW_LPAREN_in_funcDecl515 = new BitSet(new long[]{0x0020000000000000L});
    public static final BitSet FOLLOW_RPAREN_in_funcDecl517 = new BitSet(new long[]{0x0000000200000000L});
    public static final BitSet FOLLOW_LBRACE_in_funcDecl519 = new BitSet(new long[]{0x0400100082080400L});
    public static final BitSet FOLLOW_stmt_in_funcDecl523 = new BitSet(new long[]{0x0002000000000000L});
    public static final BitSet FOLLOW_RBRACE_in_funcDecl525 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_funcDecl_in_decl560 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_INT_LIT_in_literalExp598 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_STRING_LIT_in_literalExp622 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_BOOL_in_literalExp634 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_FLOAT_LIT_in_literalExp646 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_literalExp_in_atomExp696 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_MINUS_in_minusExp740 = new BitSet(new long[]{0x0400100080080400L});
    public static final BitSet FOLLOW_minusExp_in_minusExp744 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_atomExp_in_minusExp759 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_minusExp_in_addExp808 = new BitSet(new long[]{0x0001100000000002L});
    public static final BitSet FOLLOW_PLUS_in_addExp840 = new BitSet(new long[]{0x0400100080080400L});
    public static final BitSet FOLLOW_minusExp_in_addExp844 = new BitSet(new long[]{0x0001100000000002L});
    public static final BitSet FOLLOW_MINUS_in_addExp865 = new BitSet(new long[]{0x0400100080080400L});
    public static final BitSet FOLLOW_minusExp_in_addExp869 = new BitSet(new long[]{0x0001100000000002L});
    public static final BitSet FOLLOW_addExp_in_assignExp929 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_assignExp_in_exp971 = new BitSet(new long[]{0x0000000000000002L});

}